﻿<UserControl 
    x:Class="MyFloridaHouse.SilverlightOpenDistricts.MainPage"
    xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"  
    xmlns:controlsToolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Toolkit" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    xmlns:m="clr-namespace:Microsoft.Maps.MapControl;assembly=Microsoft.Maps.MapControl"
    xmlns:local="clr-namespace:MyFloridaHouse.SilverlightOpenDistricts"
    xmlns:customUI="clr-namespace:MyFloridaHouse.libSvUIControls;assembly=libSvUIControls"
    xmlns:data="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data"  
    xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"  
    xmlns:dataInput="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data.Input"  
    xmlns:commonUtil="clr-namespace:MyFloridaHouse.libSvCommonUtilities.Converters;assembly=libSvCommonUtilities"  
    xmlns:c1="http://schemas.componentone.com/winfx/2006/xaml"  
    mc:Ignorable="d" d:DesignWidth="900" d:DesignHeight="480"
    >
    
    <UserControl.Resources>
        <!-- 
            NOTE: All dictionaries are picked up in the App.xaml, including styles here allows us to see the effects in the Visual Studio Designer
            NOTE: The converter staticResources will show up here as "Could not be resolved", but they will be picked up from App.xaml at runtime
        -->
        <ResourceDictionary Source="/libSvCommonUtilities;component/Resources/Styles.xaml"/>
    </UserControl.Resources>
    <!--x:Name="uc_MainPage"-->
    <Grid x:Name="LayoutRoot"  Background="{StaticResource MainPageBackgroundBrush}">
        <Grid.RowDefinitions>
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <Grid Grid.Row="0"  Visibility="{Binding isInitializeComplete, Converter={StaticResource ConvertNotBoolToVisibility}}" >
            <Grid.RowDefinitions>
                <RowDefinition Height="auto" />
                <RowDefinition Height="auto" />
                <RowDefinition Height="*" />
            </Grid.RowDefinitions>
            <StackPanel Grid.Row="0" Orientation="Horizontal">
                <Image Source="Images/Btn_MyDistrictBuilder.jpg"     ></Image>
            </StackPanel>
            <StackPanel Grid.Row="1"  Orientation="Horizontal">
                <dataInput:Label Tag="{Binding}" FontSize="14" Content="(CensusGeometry Loading)" Style="{StaticResource LabelStyle}"  Background="Yellow" Visibility="{Binding  censusGeometry.isInitializeComplete, Converter={StaticResource ConvertNotBoolToVisibility}}"  />
                <dataInput:Label Tag="{Binding}" FontSize="14" Content="(CensusGeometry Error-CLOSE ALL BROWSERS and restart)" Style="{StaticResource LabelStyle}"  Background="Orange" Visibility="{Binding  censusGeometry.isInitializeError, Converter={StaticResource ConvertVisibilityFromBool}}"  />
                <dataInput:Label Tag="{Binding}" FontSize="14" Content="(Plan Types Loading)" Style="{StaticResource LabelStyle}"  Background="Yellow" Visibility="{Binding  districtPlanTypes.isInitializeComplete, Converter={StaticResource ConvertNotBoolToVisibility}}"  />
                <dataInput:Label Tag="{Binding}" FontSize="14" Content="(Plan Types  Error)" Style="{StaticResource LabelStyle}"  Background="Orange" Visibility="{Binding  districtPlanTypes.isInitializeError, Converter={StaticResource ConvertVisibilityFromBool}}"  />
                <dataInput:Label Tag="{Binding}" FontSize="14" Content="(Layers Loading)" Style="{StaticResource LabelStyle}"  Background="Yellow" Visibility="{Binding isLayersInitializeCompleted, Converter={StaticResource ConvertNotBoolToVisibility}}"  />
                <dataInput:Label Tag="{Binding}" FontSize="14" Content="(Layers Error)" Style="{StaticResource LabelStyle}"  Background="Orange" Visibility="{Binding  isLayersInitializeError, Converter={StaticResource ConvertVisibilityFromBool}}"  />
            </StackPanel>
            <StackPanel Grid.Row="2" Orientation="Vertical" VerticalAlignment="Top" HorizontalAlignment="Left"  Margin="10"  >
                <TextBlock FontSize="16" Margin ="20" TextWrapping="Wrap" Width="400" Text="(If MyDistrictBuilder loading takes longer than 2 minutes, close all open Internet browsers and restart the application)" />
            </StackPanel>
        </Grid>
        <Grid Grid.Row="0" Background="{StaticResource MainPageBackgroundBrush}" KeyUp="LayoutRoot_KeyUp"  Visibility="{Binding isInitializeComplete, Converter={StaticResource ConvertBoolToVisibility}}">
        <Grid.RowDefinitions>
            <RowDefinition Height="auto" />
            <RowDefinition Height="auto" />
            <RowDefinition Height="auto" />
            <RowDefinition Height="auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>

        <!-- show the status line at the top -->
        <StackPanel Grid.Row="0" Grid.Column="0" Orientation="Horizontal">
            <Button  ToolTipService.ToolTip="Florida House of Representatives - MyDistrictBuilder" >
                <Button.Content>
                    <Image Source="Images/Btn_MyDistrictBuilder.jpg"     ></Image>
                </Button.Content>
            </Button>
            <StackPanel Orientation="Vertical">
                <StackPanel Orientation="Horizontal">
                    <sdk:Label Style="{StaticResource lblAppTitleStyle}"  Content="(" />
                    <sdk:Label Style="{StaticResource lblAppTitleStyle}"  Content="{Binding districtPlan.districtPlanTypeName}" />
                    <sdk:Label Style="{StaticResource lblAppTitleStyle}"  Content=")" />
                </StackPanel>
                <StackPanel Orientation="Horizontal">
                    <sdk:Label Style="{StaticResource lblAppTitleStyle}"  Content="(" />
                    <sdk:Label Style="{StaticResource lblAppTitleStyle}"  Content="{Binding districtPlan.districtPlanName}" />
                    <sdk:Label Style="{StaticResource lblAppTitleStyle}"  Content=")" />
                </StackPanel>
            </StackPanel>
            <Border BorderThickness="1">
                <StackPanel Orientation="Vertical">
                    <StackPanel Orientation="Horizontal"  >
                        <dataInput:Label Grid.Row ="2" Grid.Column="0" Content="Click Lat/Long"  Style="{StaticResource lblHeaderStyle}"></dataInput:Label>
                    </StackPanel>
                    <StackPanel Orientation="Horizontal"  >
                            <TextBox  Grid.Row ="2" Grid.Column="1" Width="122" Style="{StaticResource TxtBxLatLonStyle}" Text="{Binding  displayMouseLatLon }"  VerticalAlignment="center"/>
                    </StackPanel>
                </StackPanel>
            </Border>
            <Border BorderThickness="1" VerticalAlignment="Center">
                <StackPanel Orientation="Vertical">
                <StackPanel Orientation="Horizontal"  >
                    <dataInput:Label Content="Zoom:" Style="{StaticResource LabelStyle}"></dataInput:Label>
                    <dataInput:Label x:Name="lbl_ZoomLevel" Width="20" Content="{Binding  ElementName=MyXamlMainMap, Path=ZoomLevel }" Style="{StaticResource LabelStyle}" />
                </StackPanel>
                <StackPanel Orientation="Horizontal"  >
                    <dataInput:Label Content="District:" Style="{StaticResource LabelStyle}"></dataInput:Label>
                    <dataInput:Label Content="{Binding  districtPlan.currentDistrict }" Style="{StaticResource LabelStyle}" />
                </StackPanel>
                    <dataInput:Label x:Name="lbl_findStatus" Content="{Binding findStatus, Mode=OneWay}" Style="{StaticResource LabelStyle}" />
                </StackPanel>
            </Border>
            <Border BorderThickness="1">
                <StackPanel Orientation="Vertical"  >
                        <StackPanel Orientation="Horizontal" Background="Yellow" Visibility="{Binding  serviceDAL.GetRegionListShapesRequestActiveCount, Converter={StaticResource ConvertVisibilityFromInt}}" >
                            <dataInput:Label Tag="{Binding}" Content="(Shapes Loading)" Style="{StaticResource LabelStyle}" Height="11" />
                            <dataInput:Label Tag="{Binding}" Content="{Binding  serviceDAL.GetRegionListShapesRequestActiveCount}" Style="{StaticResource LabelStyle}" Height="11" />
                        </StackPanel>
                        <StackPanel Orientation="Horizontal" Background="Yellow" Visibility="{Binding  serviceDAL.GetRegionListShapesRequestPendingCount, Converter={StaticResource ConvertVisibilityFromInt}}">
                            <dataInput:Label Tag="{Binding}" Content="(Shapes Pending)" Style="{StaticResource LabelStyle}" Height="11" />
                            <dataInput:Label Tag="{Binding}" Content="{Binding  serviceDAL.GetRegionListShapesRequestPendingCount}" Style="{StaticResource LabelStyle}" Height="11" />
                        </StackPanel>
                        <StackPanel Orientation="Horizontal" Background="Yellow" Visibility="{Binding  serviceDAL.regionListDataRequestActiveCount, Converter={StaticResource ConvertVisibilityFromInt}}" >
                            <dataInput:Label Tag="{Binding}" Content="(Data Loading)" Style="{StaticResource LabelStyle}" Height="11" />
                            <dataInput:Label Tag="{Binding}" Content="{Binding  serviceDAL.regionListDataRequestActiveCount}" Style="{StaticResource LabelStyle}" Height="11" />
                        </StackPanel>
                        <StackPanel Orientation="Horizontal" Background="Yellow" Visibility="{Binding  serviceDAL.getDistrictDataSummaryRequestCount, Converter={StaticResource ConvertVisibilityFromInt}}" >
                            <dataInput:Label Tag="{Binding}" Content="(Summary Loading)" Style="{StaticResource LabelStyle}" Height="11" />
                            <dataInput:Label Tag="{Binding}" Content="{Binding  serviceDAL.getDistrictDataSummaryRequestCount}" Style="{StaticResource LabelStyle}" Height="11" />
                        </StackPanel>
                    </StackPanel>
            </Border>
                <StackPanel Orientation="Vertical">
                    <StackPanel Orientation="Horizontal">
                        <dataInput:Label Tag="{Binding}" Content="(Building District)" Background="Yellow" Visibility="{Binding serviceDAL.getDistrictShapeRequestCount, Converter={StaticResource ConvertVisibilityFromInt}}" Style="{StaticResource LabelStyle}" Height="15" />
                        <dataInput:Label Tag="{Binding}" Content="{Binding serviceDAL.getDistrictShapeRequestCount}" Background="Yellow" Visibility="{Binding serviceDAL.getDistrictShapeRequestCount, Converter={StaticResource ConvertVisibilityFromInt}}" Style="{StaticResource LabelStyle}" Height="15" />
                    </StackPanel>
                </StackPanel>
                <!--<StackPanel Orientation="Vertical">
                    <StackPanel Orientation="Horizontal">
                        <Grid Background="{StaticResource MainPageBackgroundBrush}">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="auto" />
                                <RowDefinition Height="auto" />
                                <RowDefinition Height="auto" />
                                <RowDefinition Height="auto" />
                                <RowDefinition Height="auto" />
                                <RowDefinition Height="auto" />
                                <RowDefinition Height="auto" />
                                <RowDefinition Height="auto" />
                                <RowDefinition Height="auto" />
                                <RowDefinition Height="auto" />
                                <RowDefinition Height="auto" />
                                <RowDefinition Height="auto" />
                                <RowDefinition Height="auto" />
                                <RowDefinition Height="auto" />
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="auto" />
                                <ColumnDefinition Width="auto" />
                                <ColumnDefinition Width="auto" />
                                <ColumnDefinition Width="auto" />
                                <ColumnDefinition Width="auto" />
                                <ColumnDefinition Width="auto" />
                                <ColumnDefinition Width="auto" />
                                <ColumnDefinition Width="auto" />
                                <ColumnDefinition Width="auto" />
                                <ColumnDefinition Width="auto" />
                            </Grid.ColumnDefinitions>

                            <dataInput:Label Grid.Row ="0" Grid.Column="0" Grid.ColumnSpan="9"  Content="Map Dims" Style="{StaticResource lblHeaderStyle}"/>

                            <dataInput:Label Grid.Row ="1" Grid.Column="1" Content="Lat"  Style="{StaticResource LabelStyle}"></dataInput:Label>
                            <dataInput:Label Grid.Row ="1" Grid.Column="2" Content="   "  Style="{StaticResource LabelStyle}"></dataInput:Label>
                            <dataInput:Label Grid.Row ="1" Grid.Column="3" Content="Lon"  Style="{StaticResource LabelStyle}"></dataInput:Label>

                            <dataInput:Label Grid.Row ="3" Grid.Column="0"   Content="NW" Style="{StaticResource lblHeaderStyle}"/>
                            <TextBox         Grid.Row ="3" Grid.Column="1" Text="{Binding  mapLatLonNW.Latitude }" Style="{StaticResource TxtBxLatLonStyle}" VerticalAlignment="center"/>
                            <TextBox         Grid.Row ="3" Grid.Column="3" Text="{Binding  mapLatLonNW.Longitude }" Style="{StaticResource TxtBxLatLonStyle}" VerticalAlignment="center"/>

                            <dataInput:Label Grid.Row ="4" Grid.Column="0"   Content="SE" Style="{StaticResource lblHeaderStyle}"/>
                            <TextBox         Grid.Row ="4" Grid.Column="1" Text="{Binding  mapLatLonSE.Latitude }" Style="{StaticResource TxtBxLatLonStyle}" VerticalAlignment="center"/>
                            <TextBox         Grid.Row ="4" Grid.Column="3" Text="{Binding  mapLatLonSE.Longitude }" Style="{StaticResource TxtBxLatLonStyle}" VerticalAlignment="center"/>

                            <dataInput:Label Grid.Row ="1" Grid.Column="7" Content="X"  Style="{StaticResource LabelStyle}"></dataInput:Label>
                            <dataInput:Label Grid.Row ="1" Grid.Column="9" Content="Y"  Style="{StaticResource LabelStyle}"></dataInput:Label>

                            <dataInput:Label Grid.Row ="3" Grid.Column="5"   Content="NW" Style="{StaticResource lblHeaderStyle}"/>
                            <TextBox         Grid.Row ="3" Grid.Column="7" Text="{Binding  mapViewPortNW.Y }" Style="{StaticResource TxtBxLatLonStyle}" VerticalAlignment="center"/>
                            <TextBox         Grid.Row ="3" Grid.Column="9" Text="{Binding  mapViewPortNW.X }" Style="{StaticResource TxtBxLatLonStyle}" VerticalAlignment="center"/>


                            <dataInput:Label Grid.Row ="4" Grid.Column="5"   Content="SE" Style="{StaticResource lblHeaderStyle}"/>
                            <TextBox         Grid.Row ="4" Grid.Column="7" Text="{Binding  mapViewPortSE.Y }" Style="{StaticResource TxtBxLatLonStyle}" VerticalAlignment="center"/>
                            <TextBox         Grid.Row ="4" Grid.Column="9" Text="{Binding  mapViewPortSE.X }" Style="{StaticResource TxtBxLatLonStyle}" VerticalAlignment="center"/>

                            <dataInput:Label Grid.Row ="10" Grid.Column="0"  Grid.ColumnSpan="5" Content="L/L per X/Y" Style="{StaticResource lblHeaderStyle}"/>
                            <TextBox         Grid.Row ="11" Grid.Column="1" Text="{Binding  mapLatitudePerPixel }" Style="{StaticResource TxtBxLatLonStyle}" VerticalAlignment="center"/>
                            <TextBox         Grid.Row ="11" Grid.Column="3" Text="{Binding  mapLongitudePerPixel }" Style="{StaticResource TxtBxLatLonStyle}" VerticalAlignment="center"/>

                        </Grid>
                    </StackPanel>
                </StackPanel>-->
            </StackPanel>

        <!-- Main Menu and Ribbon Bar-->
        <sdk:TabControl  Grid.Row="1" VerticalAlignment="Top"
				DisplayMemberPath="Content" 
				Background="{StaticResource MainPageBackgroundBrush}"
                BorderThickness="0"
                >
            <sdk:TabItem   >
                <!-- File Menu Ribbon-->
                <sdk:TabItem.Header>
                    <TextBlock Text="File" Margin="19 2 19 0" />
                </sdk:TabItem.Header>
                <sdk:TabItem.Content>
                        <StackPanel Orientation="Horizontal">
                            <Button Content="New"  ToolTipService.ToolTip="Create a new district plan"   Command="{Binding CmdFileNew}"  ></Button>
                            <Button Content="Save" ToolTipService.ToolTip="Save the active district plan to a file"  Command="{Binding CmdFileSave}" ></Button>
                            <Button Content="Open" ToolTipService.ToolTip="Open an existing district plan"  Command="{Binding CmdFileImport}" ></Button>
                            <Button Content="Open Current Districts" ToolTipService.ToolTip="Open a district plan from 2002"  Command="{Binding CmdFileImportCloud}" ></Button>
                            <sdk:Label Content="  |  " />
                            <Button Content="How to Submit a Plan"  ToolTipService.ToolTip="Directions on how to submit a plan to the Florida House of Representatives" Command="{Binding CmdFileSubmit}" ></Button>
                            <sdk:Label Content="  |  " />
                            <Button Content="Batch PDF Print"  ToolTipService.ToolTip="Generate all Possible PDF files for the loaded district plan; requires local admin privilge to access files" Command="{Binding CmdReportsBatchPDF}"></Button>
                            <Button Content="Print Map to PDF" ToolTipService.ToolTip="Generate a PDF from the active district plan and save it to a file" Command="{Binding CmdReportsDistrictPlanPDF}"></Button>
                            <!--<Button Content="Save As" Command="{Binding CmdFileSaveAs}" ></Button>-->
                            <!--<Button Content="Print"   Command="{Binding CmdFilePrint}" ></Button>-->
                        </StackPanel>
                    </sdk:TabItem.Content>

            </sdk:TabItem>

            <sdk:TabItem  Visibility="{Binding districtPlan.districtCount, Converter={StaticResource ConvertVisibilityFromInt}}" >
                <!-- Build Menu Ribbon-->
                <sdk:TabItem.Header>
                    <TextBlock Text="Build" Margin="19 2 19 0" />
                </sdk:TabItem.Header>
                <sdk:TabItem.Content>
                    <StackPanel Orientation="Horizontal"   Background="{Binding districtSelectedFillColorBrush }">

                            <StackPanel Orientation="Vertical" >
                                <Border BorderThickness="1" BorderBrush="{Binding districtPlan.isShowDistrictRibbonSelected, Converter={StaticResource ConvertBoolToLockedBrush}}">
                                    <ToggleButton IsThreeState="False" IsChecked="{Binding districtPlan.isShowDistrictRibbonSelected, Mode=TwoWay}" Content="D" Width="20" ToolTipService.ToolTip="Show/Hide Districts Ribbon" Margin="6"/>
                                </Border>
                        <Border BorderThickness="1" BorderBrush="{Binding districtPlan.isShowDistrictStragglerRibbonSelected, Converter={StaticResource ConvertBoolToLockedBrush}}">
                                    <ToggleButton IsThreeState="False" IsChecked="{Binding districtPlan.isShowDistrictStragglerRibbonSelected, Mode=TwoWay}" Content="S"  Width="20" ToolTipService.ToolTip="Show/Hide Straggler Ribbon" Margin="6"/>
                        </Border>
</StackPanel>
                        <sdk:Label Content=" | "/>
                        <Border >
                            <StackPanel Orientation="Horizontal">
                                    <StackPanel Orientation="Vertical">
                                        <Button Content="Cut"   Margin="1"  Height="20"  Command="{Binding CmdBuildCut}"  ToolTipService.ToolTip="Remove current district from map, save a copy in MyDistrictBuilder clipboard" ></Button>
                                        <Button Content="Copy"  Margin="1"  Height="20"  Command="{Binding CmdBuildCopy}"   ToolTipService.ToolTip="Save a copy of current district in MyDistrictBuilder clipboard"  ></Button>
                                        <Button Content="Paste" Margin="1"  Height="20"  Command="{Binding CmdBuildPaste}"    ToolTipService.ToolTip="Paste contents of MyDistrictBuilder clipboard to the currently selected district" ></Button>
                                    </StackPanel>
                                    <sdk:Label Content=" | "/>
                                    <ToggleButton Margin="2"  Height="40" Command="{Binding CmdBuildLockDistrictAll}"  ToolTipService.ToolTip="Lock/Unlock all Districts">
                                    <ToggleButton.Content>
                                        <StackPanel Orientation="Vertical">
                                            <sdk:Label Content="Lock" />
                                            <sdk:Label Content="All" />
                                        </StackPanel>
                                    </ToggleButton.Content>
                                </ToggleButton>
                                    
                                <ToggleButton Margin="2" Height="20" Content="Lock" Command="{Binding CmdBuildLockDistrict}" ToolTipService.ToolTip="Lock/Unlock current District"></ToggleButton>
                                <ComboBox  Height="20"  x:Name="cmbDistrict" ItemsSource="{Binding districtPlan.districtList}" SelectedIndex="{Binding districtPlan.districtSelectedIndex, Mode=TwoWay}" Tag="{Binding}"  >
                                    <ComboBox.ItemTemplate>
                                        <DataTemplate>
                                            <Border HorizontalAlignment="Stretch"  Background="{Binding fillColorBrush}">
                                            <sdk:Label Content="{Binding displayName}" Width="50" />
                                            </Border>
                                        </DataTemplate>
                                    </ComboBox.ItemTemplate>
                                </ComboBox>


                                </StackPanel>
                        </Border>


                                <Border  Background="{Binding isSelectedBuildLayerHidden, Converter={StaticResource ConvertIndicatorBrushFromBool}, ConverterParameter=WARNING}">
                            <StackPanel Orientation="Horizontal" ToolTipService.ToolTip="Background will show different background when selection is not shown on map, you will build with selection, not items shown on map">
                                <dataInput:Label   Content="Build With " Style="{StaticResource lblDataStyle}"/>
                                <ComboBox Height="20"  ItemsSource="{Binding buildLayerList}" SelectedIndex="{Binding buildLayerListSelectedIndex, Mode=TwoWay}"  DisplayMemberPath="layerName" Tag="{Binding}" />
                            </StackPanel>
                        </Border>
                            <Border   Background="{Binding districtBuildInProgress, Converter={StaticResource ConvertIndicatorBrushFromBool}}" >
                                <StackPanel Orientation="Horizontal">
                        <Border Style="{StaticResource BuildTypeRadioButtonBorder}" VerticalAlignment="Center">
                            <StackPanel Orientation="Vertical" ToolTipService.ToolTip="No district building possible in this mode, allows you to look around map without affecting districts">
                                <TextBlock  Style="{StaticResource BuildTypeRadioButtonText}" Text="Explore" />
                                            <RadioButton Style="{StaticResource BuildTypeRadioButton}" IsChecked="{Binding mapMode, Mode=TwoWay, Converter={StaticResource ConvertEnumToBool}, ConverterParameter=Explore}" />
                                        </StackPanel>
                        </Border>

                                    <Border Style="{StaticResource BuildTypeRadioButtonBorder}" VerticalAlignment="Center">
                                        <StackPanel Orientation="Vertical"  ToolTipService.ToolTip="Single click mode, allows you to add a single geography (the type shown in the 'Build With' combo box) to the current district">
                                <TextBlock  Style="{StaticResource BuildTypeRadioButtonText}" Text="Assign" />
                                            <RadioButton  Style="{StaticResource BuildTypeRadioButton}" IsChecked="{Binding mapMode, Mode=TwoWay, Converter={StaticResource ConvertEnumToBool}, ConverterParameter=Click}" />
                                        </StackPanel>
                        </Border>


                                    <Border Style="{StaticResource BuildTypeRadioButtonBorder}" VerticalAlignment="Center">
                                        <StackPanel Orientation="Vertical"  ToolTipService.ToolTip="Lasso click mode, allows you to add a group of geographies (the type shown in the 'Build With' combo box) to the current district.  Double Click to end, Click Explore to cancel.">
                                <TextBlock  Style="{StaticResource BuildTypeRadioButtonText}" Text="Lasso" />
                                            <RadioButton Style="{StaticResource BuildTypeRadioButton}"  IsChecked="{Binding mapMode, Mode=TwoWay, Converter={StaticResource ConvertEnumToBool}, ConverterParameter=Lasso}" />
                                        </StackPanel>
                                    </Border>
                                </StackPanel>
                                
                            </Border>
                            <Button Content="Undo"     Height="20" Command="{Binding CmdBuildUndo}" ToolTipService.ToolTip="Undo Last Assignment"  ></Button>
                            <Button Content="Redo"    Height="20"  Command="{Binding CmdBuildRedo}" ToolTipService.ToolTip="Redo Last Assignment (can be to different district) "  ></Button>
                            <Button  Height="40" Command="{Binding CmdBuildShaded}" ToolTipService.ToolTip="Add shaded areas to current District"  >
                            <Button.Content>
                                <StackPanel Orientation="Vertical">
                                    <sdk:Label FontSize="9" Content="Build" />
                                    <sdk:Label FontSize="9"  Content="Shaded" />
                                </StackPanel>
                            </Button.Content>
                        </Button>

                            <Border BorderThickness="1"   >
                                <StackPanel Orientation="Vertical" VerticalAlignment="Center" Margin="1">

                                    <Grid>
                                        <Grid.RowDefinitions>
                                            <RowDefinition Height="auto" />
                                            <RowDefinition Height="auto" />
                                            <RowDefinition Height="auto" />
                                        </Grid.RowDefinitions>
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="auto" />
                                            <ColumnDefinition Width="auto" />
                                            <ColumnDefinition Width="auto" />
                                            <ColumnDefinition Width="auto" />
                                            <ColumnDefinition Width="auto" />
                                        </Grid.ColumnDefinitions>

                                        <CheckBox Grid.Row="0" Grid.Column="0" HorizontalAlignment="Left" Tag="{Binding}" IsChecked="{Binding showLayer, Mode=TwoWay}" Margin="2" VerticalAlignment="Center"   ToolTipService.ToolTip="Show/Hide Districts on the map"  x:Name="DistrictMapLayerDisplayControl"/>
                                        <dataInput:Label Grid.Row="0" Grid.Column="1" Grid.ColumnSpan="3" Content="Show Districts:"  HorizontalAlignment="Left" ></dataInput:Label>
                                        <CheckBox Grid.Row="1" Grid.Column="0" HorizontalAlignment="Left" Tag="{Binding}" IsChecked="{Binding showRegionNames, Mode=TwoWay}" Margin="2" VerticalAlignment="Center"   ToolTipService.ToolTip="Show/Hide District number labels"   x:Name="DistrictMapLayerDisplayIDLabelControl"/>
                                        <dataInput:Label Grid.Row="1" Grid.Column="1" Content="Numbers"   HorizontalAlignment="Left" ></dataInput:Label>
                                        <CheckBox Grid.Row="1" Grid.Column="2" HorizontalAlignment="Left" Tag="{Binding}" IsChecked="{Binding showFill, Mode=TwoWay}" Margin="2" VerticalAlignment="Center"   ToolTipService.ToolTip="Show/Hide District Fill"   x:Name="DistrictMapLayerFillControl"/>
                                        <dataInput:Label Grid.Row="1" Grid.Column="3" Content="Fill on/off    "  HorizontalAlignment="Left" ></dataInput:Label>
                                        <CheckBox Grid.Row="2" Grid.Column="0" HorizontalAlignment="Left" Tag="{Binding}" IsChecked="{Binding showDistrictsPopDev, Mode=TwoWay}" Margin="2" VerticalAlignment="Center"   ToolTipService.ToolTip="Show/Hide District Population Deviation labels"  x:Name="DistrictMapLayerPopDevLabelControl"/>
                                        <dataInput:Label Grid.Row="2" Grid.Column="1"  Content="Pop Dev"  HorizontalAlignment="Left" ></dataInput:Label>
                                        <CheckBox Grid.Row="3" Grid.Column="2"  HorizontalAlignment="Left" Tag="{Binding}"   Visibility="{Binding showFill, Converter={StaticResource ConvertVisibilityFromBool}}"  IsChecked="{Binding showDistrictsPopDevShading, Mode=TwoWay}" Margin="2" VerticalAlignment="Center"   ToolTipService.ToolTip="Show/Hide District Population Deviation Fill"  x:Name="DistrictMapLayerFillPopDevControl"/>
                                        <dataInput:Label Grid.Row="3" Grid.Column="3"  Content="Pop Dev Fill" HorizontalAlignment="Left"   Visibility="{Binding showFill, Converter={StaticResource ConvertVisibilityFromBool}}" x:Name="DistrictMapLayerFillPopDevText"  ></dataInput:Label>
                                        <Border Grid.Row="0" Grid.Column="5" Grid.RowSpan="4"  Margin="1" Background="AliceBlue">
                                            <StackPanel Orientation="Horizontal"   x:Name="DistrictMapLayerOpacityControl" Margin="2" >
                                                <StackPanel Orientation="Vertical"  Grid.Row="0" Grid.Column="5"   >
                                                    <dataInput:Label Content="District"       ></dataInput:Label>
                                                    <dataInput:Label Content="Opacity"       ></dataInput:Label>
                                                    <Border>
                                                        <dataInput:Label Content="{Binding opacity}" Margin="5"      ></dataInput:Label>
                                                    </Border>
                                                </StackPanel>
                                                <Slider Height="60" Minimum="0" Maximum="100" Value="{Binding opacity, Mode=TwoWay}" Orientation="Vertical" />
                                            </StackPanel>
                                        </Border>
                                    </Grid>
                                </StackPanel>
                            </Border>

                            <Border BorderThickness="1" Visibility="{Binding districtPlan.censusGeometry.splitVTDs, Converter={StaticResource ConvertVisibilityFromInt}}" Background="BlanchedAlmond" ToolTipService.ToolTip="The plan has one or more unassigned geographies. See Help/Tutorials 'How to Find Unassigned Geography Blocks" Margin="2">
                                <StackPanel Orientation="Vertical" VerticalAlignment="Center" Margin="4">
                                    <sdk:Label FontSize="9" Content="Assigned Geography"  HorizontalAlignment="Center" />
                                    <sdk:Label FontSize="9" Content="Split VTD Count:"  HorizontalAlignment="Center" />
                                    <sdk:Label FontSize="9" Content="{Binding districtPlan.censusGeometry.splitVTDs}"  HorizontalAlignment="Center" />
                                </StackPanel>
                            </Border>

                            <Border BorderThickness="1" Visibility="{Binding districtPlan.censusGeometry.blocksRemaining, Converter={StaticResource ConvertVisibilityFromInt}}" Background="BlanchedAlmond" ToolTipService.ToolTip="The plan has one or more unassigned geographies. See Help/Tutorials 'How to Find Unassigned Geography Blocks"  Margin="2">
                                <StackPanel Orientation="Vertical" VerticalAlignment="Center" Margin="4">
                                    <sdk:Label FontSize="9" Content="Unassigned Geography"  HorizontalAlignment="Center" />
                                    <sdk:Label FontSize="9" Content="Blocks Remaining:"  HorizontalAlignment="Center" />
                                    <sdk:Label FontSize="9" Content="{Binding districtPlan.censusGeometry.blocksRemaining}"  HorizontalAlignment="Center" />
                                </StackPanel>
                            </Border>
                        </StackPanel>
                    
                </sdk:TabItem.Content>
            </sdk:TabItem>

            <!-- Configure-->
            <!--<sdk:TabItem Visibility="{Binding districtCount, Converter={StaticResource ConvertVisibilityFromInt}}">
                <sdk:TabItem.Header>
                    <TextBlock Text="Configure" Margin="19 2 19 0" />
                </sdk:TabItem.Header>
                <sdk:TabItem.Content>
                    <StackPanel Orientation="Horizontal">

                        <Button Content="District"   Command="{Binding CmdDistrictConfig}"   ></Button>
                        <Button Margin="2" Height="20" Content="Layers" Command="{Binding CmdConfig}"  ></Button>
                    </StackPanel>
                </sdk:TabItem.Content>
            </sdk:TabItem>-->

            <!-- Data -->
            <!--<sdk:TabItem Visibility="{Binding districtCount, Converter={StaticResource ConvertVisibilityFromInt}}">
                <sdk:TabItem.Header>
                    <TextBlock Text="Data" Margin="19 2 19 0" />
                </sdk:TabItem.Header>
                <sdk:TabItem.Content>
                    <StackPanel Orientation="Horizontal">

                        <dataInput:Label   Content="TBD " Style="{StaticResource lblDataStyle}"/>
                    </StackPanel>
                </sdk:TabItem.Content>
            </sdk:TabItem>-->

            <!-- Reports Menu Ribbon-->
            <!--<sdk:TabItem Visibility="{Binding districtCount, Converter={StaticResource ConvertVisibilityFromInt}}">
                <sdk:TabItem.Header>
                    <TextBlock Text="Reports" Margin="19 2 19 0" />
                </sdk:TabItem.Header>
                <sdk:TabItem.Content>
                    <StackPanel Orientation="Horizontal">

                        <dataInput:Label   Content="TBD " Style="{StaticResource lblDataStyle}"/>
                    </StackPanel>
                </sdk:TabItem.Content>
            </sdk:TabItem>-->

            <!-- Tools Menu Ribbon-->
            <!--<sdk:TabItem Visibility="{Binding districtCount, Converter={StaticResource ConvertVisibilityFromInt}}">
                <sdk:TabItem.Header>
                    <TextBlock Text="Tools" Margin="19 2 19 0" />
                </sdk:TabItem.Header>
                <sdk:TabItem.Content>
                    <StackPanel Orientation="Horizontal">

                        <Button Content="Find" Click="btn_FindPopup_Click"   ></Button>
                        <Button Margin="2" Height="20" Content="Distance" Command="{Binding CmdToolsDistance}"  ></Button>
                        <dataInput:Label   Content="    |   " Style="{StaticResource lblDataStyle}"/>
                        <Button Content="Renumber" ToolTipService.ToolTip="Not available yet" Command="{Binding CmdDistrictRenumber}"   ></Button>
                        <Button Content="Stragglers" ToolTipService.ToolTip="Not available yet" Command="{Binding CmdToolsGetNonContiguousDistricts}"   ></Button>
                        <Button Content="Holes" ToolTipService.ToolTip="Not available yet" Command="{Binding CmdToolsGetDistrictHoles}"   ></Button>

                        <dataInput:Label   Content="    |   " Style="{StaticResource lblDataStyle}"/>
                        <Button Content="Orphans" Command="{Binding CmdToolsGetUnassignedRegions}"   ></Button>
                    </StackPanel>
                </sdk:TabItem.Content>
            </sdk:TabItem>-->

                <sdk:TabItem  >
                    <!-- View Menu Ribbon-->
                    <sdk:TabItem.Header>
                        <TextBlock Text="View" Margin="19 2 19 0" />
                    </sdk:TabItem.Header>
                    <sdk:TabItem.Content>
                        <StackPanel Orientation="Horizontal">
                            <Border BorderThickness="1">
                                <StackPanel Orientation="Horizontal">
                                    <Button x:Name="btn_FullScreen" Content="Full Screen"   Click="btn_GoToFullScreen_Click" ></Button>
                                    <Button x:Name="btn_ToggleShowBing"     Height="20" Content="{Binding bingCommandLabel}"     Command="{Binding CmdToggleShowBing}"></Button>
                                    <Button x:Name="btn_ToggleShowOpenStreetMaps"     Height="20" Content="{Binding openStreetMapsCommandLabel}"     Command="{Binding CmdToggleShowOpenStreetMaps}"></Button>
                                </StackPanel>
                            </Border>

                            <!--<Border BorderThickness="1" Visibility="{Binding districtCount, Converter={StaticResource ConvertVisibilityFromInt}}">
                            <StackPanel Orientation="Horizontal">

                                <ComboBox Height="20" />
                                <Button Content="Full" Command="{Binding CmdViewFull}" ></Button>
                                <Button Content="Prev" Command="{Binding CmdViewPrev}" ></Button>
                                <Button Content="Next" Command="{Binding CmdViewNext}" ></Button>
                            </StackPanel>
                        </Border>-->
                        </StackPanel>
                    </sdk:TabItem.Content>

                </sdk:TabItem>


                <sdk:TabItem  >
                    <!-- Preferences Menu Ribbon-->
                    <sdk:TabItem.Header>
                        <TextBlock Text="Preferences" Margin="19 2 19 0" />
                    </sdk:TabItem.Header>
                    <sdk:TabItem.Content>
                        <Border BorderThickness="1">
                            <StackPanel Orientation="Horizontal">
                                <Button Content="Customize Target Population"      Command="{Binding CmdPrefDistrict}"  ToolTipService.ToolTip="Customize District Setup" ></Button>
                                <Button Content="Customize Data"      Command="{Binding CmdPrefCriteria}"  ToolTipService.ToolTip="Customize Criteria Setup" ></Button>
                            </StackPanel>
                        </Border>
                    </sdk:TabItem.Content>

                </sdk:TabItem>

                <sdk:TabItem >
                <!-- Help Menu Ribbon-->
                <sdk:TabItem.Header>
                    <TextBlock Text="Help" Margin="19 2 19 0" />
                </sdk:TabItem.Header>
                <sdk:TabItem.Content>
                    <StackPanel Orientation="Horizontal">
                        <Button Content="About"  Command="{Binding CmdHelpAbout}"   />
                        <Button Content="Quick Start"  Click="btn_HelpQuickStart_Click"   />
                        <Button Content="Tutorial"   Click="btn_HelpTutorial_Click"     />
                        <Button Content="Tutorial Videos"   Click="btn_HelpTutorialVideos_Click"     />
                        <Button Content="Glossary"   Click="btn_HelpGlossary_Click"     />
                    </StackPanel>
                </sdk:TabItem.Content>
            </sdk:TabItem>

            <sdk:TabItem >
                <!-- Help Menu Ribbon-->
                <sdk:TabItem.Header>
                    <TextBlock Text="Contact Us" Margin="19 2 19 0" />
                </sdk:TabItem.Header>
                <sdk:TabItem.Content>
                    <StackPanel Orientation="Horizontal">
                        <Button Click="btn_Email_Click" ToolTipService.ToolTip="Send email to mydistrictbuilder@myfloridahouse.gov" >
                            <Button.Content>
                                <Image Source="Images/Btn_Email.jpg"     ></Image>
                            </Button.Content>
                        </Button>
                        <Button Click="btn_Facebook_Click" ToolTipService.ToolTip="Go to the myDistrictBuilder facebook page" >
                            <Button.Content>
                                <Image Source="Images/Btn_Facebook.jpg"     ></Image>
                            </Button.Content>
                        </Button>
                        <Button Click="btn_Twitter_Click" ToolTipService.ToolTip="Go to the myDistrictBuilder twitter page" >
                        <Button.Content>
                            <Image Source="Images/Btn_Twitter.jpg"     ></Image>
                        </Button.Content>
                    </Button>
                    <Button Click="btn_YouTube_Click" ToolTipService.ToolTip="Go to the myDistrictBuilder YouTube channel" >
                        <Button.Content>
                            <Image Source="Images/Btn_YouTube.jpg"     ></Image>
                        </Button.Content>
                    </Button>
                    </StackPanel>
                </sdk:TabItem.Content>
            </sdk:TabItem>


            <sdk:TabItem >
                <!-- Report Menu Ribbon-->
                <sdk:TabItem.Header>
                    <TextBlock Text="Reports" Margin="19 2 19 0" />
                </sdk:TabItem.Header>
                <sdk:TabItem.Content>
                    <StackPanel Orientation="Horizontal">
                            <Button IsEnabled="False" Click="btn_MassDataReport_Click" Content="Data Explorer"  />
                        </StackPanel>
                </sdk:TabItem.Content>
            </sdk:TabItem>
        </sdk:TabControl>


        <!-- District Ribbon -->
            <Grid Grid.Row="2" Background="{StaticResource MainPageBackgroundBrush}"   Visibility="{Binding districtPlan.isDistrictRibbonVisible, Converter={StaticResource ConvertBoolToVisibility}}">
                <Grid.RowDefinitions>
                    <RowDefinition Height="auto" />
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="auto" />
                    <ColumnDefinition Width="*" />
                </Grid.ColumnDefinitions>
                <Button  Grid.Row="0" Grid.Column="0" Content="Unassigned" Command="{Binding CmdBuildTargetUnassigned}"  Height="25"  ToolTipService.ToolTip="Shortcut to set the target district to 'Unassigned'" />
                <ListBox   Grid.Row="0" Grid.Column="1" Margin="0"  
                  ItemsSource="{Binding districtPlan.districtList}" 
                  ScrollViewer.HorizontalScrollBarVisibility="Auto" 
                  Background="{StaticResource MainPageBackgroundBrush}" 
                  >
                
                <ListBox.ItemsPanel>
                    <ItemsPanelTemplate>
                        <StackPanel Orientation="Horizontal"></StackPanel>
                    </ItemsPanelTemplate>
                </ListBox.ItemsPanel>
                <!-- 
                                    Using a staticResource based data template that has a wrap panel for an itemsPanel causes a runtime error, so can't move this data template to resources 
                                    example of where someone else had the same problem - no solution, look after the answer: http://forums.silverlight.net/forums/p/119052/268300.aspx
                                -->
                <ListBox.ItemTemplate>
                    <DataTemplate  >
                        <Border BorderThickness="1" BorderBrush="{Binding isLocked, Converter={StaticResource ConvertBoolToLockedBrush}}"  Background="{Binding isSelected, Converter={StaticResource ConvertBoolToSelectedBrush}}"
                                 Padding="3"                >
                                <Button x:Name="btn_DistrictSelect"  Width="25" Click="btn_DistrictSelect_Click"  Tag="{Binding}" ToolTipService.ToolTip="Select the active district. Red square means it has a hole.  Black dot means it is not contiguous." >
                                <Button.Content >
                                    <Border Width="25" Background="{Binding fillColorBrush}">
                                        <StackPanel Orientation="Vertical">
                                            <dataInput:Label Content="{Binding displayName}" Style="{StaticResource LabelStyle}"  ></dataInput:Label>
                                        <StackPanel Orientation="Horizontal">
                                            <Ellipse Height="6" Width="6" Fill="Black" Visibility="{Binding isContiguous, Converter={StaticResource ConvertNotBoolToVisibility}}" VerticalAlignment="Top" ></Ellipse>
                                            <Rectangle Height="6" Width="6" Fill="Red" Visibility="{Binding hasHole, Converter={StaticResource ConvertBoolToVisibility}}" VerticalAlignment="Bottom" ></Rectangle>
                                        </StackPanel>
                                    </StackPanel>
                                    </Border>
                                </Button.Content>
                            </Button>
                        </Border>
                    </DataTemplate>
                </ListBox.ItemTemplate>
            </ListBox>
            </Grid>

            <!-- District Straggler Ribbon -->
        <Grid Grid.Row="3" Grid.Column="0" Visibility="{Binding districtPlan.isDistrictStragglerRibbonVisible, Converter={StaticResource ConvertBoolToVisibility}}">
            <Grid.RowDefinitions>
                <RowDefinition Height="50" />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="35" />
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="*" />
            </Grid.ColumnDefinitions>
 <!----> 
            <Button Grid.Column="0" x:Name="btn_DistrictExtent" Click="btn_DistrictExtent_Click" Tag="{Binding districtPlan.selectedDistrict}"
                   ScrollViewer.HorizontalScrollBarVisibility="Hidden" 
                    ScrollViewer.VerticalScrollBarVisibility="Hidden" 
                    Visibility="{Binding districtPlan.isDistrictExtentVisible, Converter={StaticResource ConvertBoolToVisibility}}">
                <Button.Content>
                    <Image Source="Images/IconDistrictSolid.jpg" Stretch="None" ToolTipService.ToolTip="Zoom to entire selected district"></Image>
                </Button.Content>
            </Button>
            <ListBox  Grid.Column="1"     
                      ItemsSource="{Binding districtPlan.selectedDistrictSubShapeList}"  
                      ScrollViewer.HorizontalScrollBarVisibility="Visible" 
                       ScrollViewer.VerticalScrollBarVisibility="Hidden"
                      Background="{StaticResource MainPageBackgroundBrush}">
                <ListBox.ItemsPanel>
                    <ItemsPanelTemplate>
                        <StackPanel Orientation="Horizontal"></StackPanel>
                    </ItemsPanelTemplate>
                </ListBox.ItemsPanel>
                <ListBox.ItemTemplate>
                    <DataTemplate  >
                        <Border BorderThickness="1" BorderBrush="Black"> 
                            <Button x:Name="btn_DistrictStraggler" Click="btn_DistrictSubshape_Click" Tag="{Binding}" ToolTipService.ToolTip="Zoom to district straggler.  NOTE: Some Stragglers are too small to see and are a result of the shapebuilding software library we are using. We hope to remove them in the future.">
                                <Button.Content>
                                    <Image Source="Images/IconDistrictStraggler.jpg" Stretch="None"></Image>
                                </Button.Content>
                            </Button>
                        </Border>
                    </DataTemplate>
                </ListBox.ItemTemplate>
            </ListBox>

                     <!--Visibility="{Binding isDistrictStragglerRibbonVisible, Converter={StaticResource ConvertBoolToVisibility}}"-->
            <ListBox   Grid.Column="2"    
                      HorizontalAlignment="Stretch"
                      ItemsSource="{Binding districtPlan.selectedDistrictHoleList}"  
                      ScrollViewer.HorizontalScrollBarVisibility="Visible" 
                       ScrollViewer.VerticalScrollBarVisibility="Hidden"
                      Background="{StaticResource MainPageBackgroundBrush}" 
                                     >
                <ListBox.ItemsPanel>
                    <ItemsPanelTemplate>
                        <StackPanel Orientation="Horizontal"></StackPanel>
                    </ItemsPanelTemplate>
                </ListBox.ItemsPanel>

                <ListBox.ItemTemplate>
                    <DataTemplate  >
                        <Border BorderThickness="1" BorderBrush="Black"><!--Content="{Binding uriString, Converter={StaticResource ConvertImageFromUriString}}"-->  
                            <Button x:Name="btn_DistrictStraggler" Click="btn_DistrictSubshape_Click" Tag="{Binding}"  >
                                <Button.Content>
                                    <Image Source="Images/IconDistrictHole.jpg" Stretch="Fill" ToolTipService.ToolTip="Zoom to hole in district"/>
                                </Button.Content>
                            </Button>
                        </Border>
                    </DataTemplate>
                </ListBox.ItemTemplate>
            </ListBox>
        
        </Grid>
        
        <Grid x:Name="ApplicationMapSpace"  Grid.Row="4"   >
            <Grid.RowDefinitions>
                <RowDefinition Height="*" MinHeight="5" />
                <RowDefinition Height="2" />
                    <RowDefinition Height="{Binding districtPlan.districtCount, Converter={StaticResource ConvertDataGridHeightFromInt}}"/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="200"/>
                <ColumnDefinition Width="2"/>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="2"/>
                <ColumnDefinition Width="150"/>
            </Grid.ColumnDefinitions>

            <Grid x:Name="LeftMenuGrid" Grid.Column="0"  Visibility="{Binding isLeftMenuVisible, Converter={StaticResource ConvertBoolToVisibility}}" >
                <Grid.RowDefinitions>
                    <RowDefinition Height="auto" />
                    <RowDefinition Height="*" />
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*"/>
                </Grid.ColumnDefinitions>
                <Grid Grid.Row="0" >
                    <Grid.RowDefinitions>
                        <RowDefinition Height="auto" />
                        <RowDefinition Height="auto" />
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*"/>
                    </Grid.ColumnDefinitions>
                    <StackPanel Orientation="Horizontal"  Grid.Row="0" Grid.Column="0"  Background="{StaticResource MainPageBackgroundBrush}" >
                            <dataInput:Label Grid.Row="0" Grid.Column="1" Content="Select Geography to Display"  Style="{StaticResource lblAppTitleStyle}"      HorizontalAlignment="Center"></dataInput:Label>
                        <!--<dataInput:Label Grid.Row="0" Grid.Column="1" Content="/Fill/"        HorizontalAlignment="Center"></dataInput:Label>
                        <dataInput:Label Grid.Row="0" Grid.Column="2" Content="Border  "  HorizontalAlignment="Center" ></dataInput:Label>-->
                    </StackPanel>


                </Grid>
                    <Grid Grid.Row="1" Grid.Column="0" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" >
                    <Grid.RowDefinitions>
                        <RowDefinition Height="*" />
                        <RowDefinition Height="auto" />
                        <RowDefinition Height="*" />
                    </Grid.RowDefinitions>

                            <Grid Grid.Row="0" Background="{StaticResource MainPageBackgroundBrush}" >
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="auto" />
                                    <RowDefinition Height="*" />
                                </Grid.RowDefinitions>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="*" />
                                </Grid.ColumnDefinitions>

                                <StackPanel Orientation="Horizontal"  Grid.Row="0" Grid.Column="0"  Background="{StaticResource MainPageBackgroundBrush}" >
                                <dataInput:Label Grid.Row="0" Grid.Column="1" Content="Show/"        HorizontalAlignment="Center"></dataInput:Label>
                                <dataInput:Label Grid.Row="0" Grid.Column="1" Content="Label/"        HorizontalAlignment="Center"></dataInput:Label>
                                <dataInput:Label Grid.Row="0" Grid.Column="2" Content="Zoom Range/"  HorizontalAlignment="Center" ></dataInput:Label>
                                        <dataInput:Label Grid.Row="0" Grid.Column="3" Content="Layer Name"  HorizontalAlignment="Center"></dataInput:Label>
                                </StackPanel>


                                <ListBox  Grid.Row="1" Grid.Column="0" 
                                      ItemsSource="{Binding mapLayerList}" Margin="0,0,0,0"   
                                      ItemTemplate="{StaticResource DataTemplateLayerSelection}"
                                      Background="{StaticResource MainPageBackgroundBrush}" >
                                    <ListBox.ItemsPanel  >
                                        <ItemsPanelTemplate>
                                            <StackPanel Orientation="Vertical" Background="{StaticResource MainPageBackgroundBrush}"></StackPanel>
                                        </ItemsPanelTemplate>
                                    </ListBox.ItemsPanel>
                                </ListBox>
                            </Grid>

                    <controls:GridSplitter x:Name="LeftMenuGridlSplitter" Grid.Row="1" VerticalAlignment="Center" HorizontalAlignment="Stretch" Background="Blue" Height="4" ToolTipService.ToolTip="Drag to adjust Layer Control/Data Display size"></controls:GridSplitter>

                    <ListBox Grid.Row="2" x:Name="lbx_RegionDataList"  Margin="0"  
                                 Background="LightBlue" 
                                 ItemTemplate="{StaticResource DataTemplateMenuRegionData}" >
                                <ListBox.ItemsPanel>
                                    <ItemsPanelTemplate>
                                        <StackPanel Background="{Binding  Path=isFreezeData, Converter={StaticResource ConvertActiveBrushFromBool}}"  />
                                    </ItemsPanelTemplate>
                                </ListBox.ItemsPanel>
                            </ListBox>
                </Grid>
            </Grid>


                    <!--<layoutToolkit:AccordionItem Header="Configure Districts"  Style="{StaticResource MenuItemStyle}" IsSelected="False"   Visibility="{Binding districtCount, Converter={StaticResource ConvertVisibilityFromInt}}" >
                        <layoutToolkit:AccordionItem.Content>
                            <StackPanel Orientation="Vertical">-->
                                <!--<CheckBox Grid.Row="1" Grid.Column="0" HorizontalAlignment="Left" Tag="{Binding}" IsChecked="{Binding showFill, Mode=TwoWay}"  Content="Fill" Click="chkBx_lbx_layerConfigListFill_Click" />

                                <dataInput:Label Grid.Row="1" Grid.Column="1" Tag="{Binding}" Content="{Binding shapeCount}" Style="{StaticResource lblHeaderStyle}"/>

                                <RadioButton GroupName="graphTypeSelectionGroup" Tag="{Binding}" Visibility="{Binding Path=isGraphLayer, Converter={StaticResource ConvertVisibilityFromBool}}" IsChecked="{Binding selectedForGraph, Mode=TwoWay}"  Click="GraphTypeSelection_Click"   ></RadioButton>
                                <dataInput:Label Tag="{Binding}" Content="{Binding layerID}"  Style="{StaticResource LabelStyle}"/>
                                <dataInput:Label Content=":"  Style="{StaticResource LabelStyle}"/>
                                <dataInput:Label Tag="{Binding}" Content="{Binding retrievingCount}" Style="{StaticResource LabelStyle}"/>
                                <dataInput:Label Content=":"  Style="{StaticResource LabelStyle}"/>-->
                            <!--</StackPanel>

                        </layoutToolkit:AccordionItem.Content>
                    </layoutToolkit:AccordionItem>-->

                    <!--<layoutToolkit:AccordionItem Header="Configure Layers"  Style="{StaticResource MenuItemStyle}" IsSelected="False"    >
                        <layoutToolkit:AccordionItem.Content>-->
                            <!-- Configuration Menu Item -->
                            <!--<StackPanel Orientation="Vertical">
                                <Border BorderBrush="Black" BorderThickness="1" Margin="0,2,0,0" Background="Gray" >
                                    <StackPanel Grid.Row="2" Grid.Column="0" Orientation="Horizontal">
                                        <dataInput:Label Style="{StaticResource lblHeaderStyle}" Content="Name" Width="100" />
                                        <dataInput:Label Style="{StaticResource lblHeaderStyle}" Content="Show" Width="40" />
                                        <dataInput:Label Style="{StaticResource lblHeaderStyle}" Content="Fill" Width="40" />
                                        <dataInput:Label Style="{StaticResource lblHeaderStyle}" Content="Zoom Min" Width="75" />
                                        <dataInput:Label Style="{StaticResource lblHeaderStyle}" Content="Zoom Max" Width="75" />
                                        <dataInput:Label Style="{StaticResource lblHeaderStyle}" Content="Color" Width="100" />
                                    </StackPanel>
                                </Border>
                                <ListBox x:Name="lbx_layerConfigList" Margin="0,0,0,0" >
                                    <ListBox.ItemTemplate>
                                        <DataTemplate>
                                            <Border BorderBrush="{Binding lineStroke}" BorderThickness="2" >

                                                <Grid>
                                                    <Grid.RowDefinitions>
                                                        <RowDefinition Height="auto" />
                                                    </Grid.RowDefinitions>
                                                    <Grid.ColumnDefinitions>
                                                        <ColumnDefinition Width="100" />
                                                        <ColumnDefinition Width="40" />
                                                        <ColumnDefinition Width="40" />
                                                        <ColumnDefinition Width="75" />
                                                        <ColumnDefinition Width="75" />
                                                        <ColumnDefinition Width="100" />
                                                    </Grid.ColumnDefinitions>
                                                    <dataInput:Label Grid.Column="0" Tag="{Binding}" Content="{Binding layerName}"                     Style="{StaticResource LabelStyle}"/>
                                                    <CheckBox        Grid.Column="1" Tag="{Binding}" IsChecked="{Binding showLayer, Mode=TwoWay}"           Click="chkBx_lbx_layerConfigListShow_Click" />
                                                    <CheckBox        Grid.Column="2" Tag="{Binding}" IsChecked="{Binding showFill, Mode=TwoWay}"            Click="chkBx_lbx_layerConfigListFill_Click" HorizontalAlignment="Center"/>
                                                    <TextBox         Grid.Column="3" Tag="{Binding}" Text="{Binding minZoomLevel, Mode=TwoWay}"        Style="{StaticResource TxtBxStyle}"  LostFocus ="txtBx_lbx_layerConfigListMinZoom_LostFocus" />
                                                    <TextBox         Grid.Column="4" Tag="{Binding}" Text="{Binding maxZoomLevel, Mode=TwoWay}"        Style="{StaticResource TxtBxStyle}" LostFocus ="txtBx_lbx_layerConfigListMaxZoom_LostFocus" />
                                                    <ComboBox        Grid.Column="5" Tag="{Binding}" ItemsSource="{Binding colorList, Mode=TwoWay}"    SelectedIndex="{Binding SelectedColorIndex, Mode=TwoWay}"   Background="{Binding lineStroke}" SelectionChanged="cmbBx_LayerColor_SelectionChanged" />
                                                </Grid>
                                            </Border>
                                        </DataTemplate>
                                    </ListBox.ItemTemplate>
                                </ListBox>
                            </StackPanel>-->
                            <!--<sdk:Label Content=""></sdk:Label>
                        </layoutToolkit:AccordionItem.Content>
                    </layoutToolkit:AccordionItem>-->


                <!--</layoutToolkit:Accordion>-->


                <Border x:Name="BingMapBorder" Grid.Row="0" Grid.Column="2" BorderThickness="2" BorderBrush="Black" Background="{Binding mapBackgroundBrush}">
                    <m:Map CredentialsProvider=""
                x:Name="MyXamlMainMap" 
                Center="{Binding mapCenter, Mode=TwoWay}" 
                ZoomLevel="{Binding mapZoomLevel, Mode=TwoWay}"  
                CopyrightVisibility="Visible" 
                ScaleVisibility="Visible" 
                NavigationVisibility="Visible"
                LogoVisibility="Collapsed"
                ViewChangeStart="MyMap_ViewChangeStart"
                ViewChangeEnd="MyMap_ViewChangeEnd"
                MouseClick="MyMap_MouseClick"
                MouseDoubleClick="MyMap_MouseDoubleClick"
                Mode="AerialWithLabels"
                >
            </m:Map>
            </Border>

                <customUI:MiniMap   Grid.Row="0" Grid.Column="2" 
                    x:Name="MyMiniMap" 
                    HorizontalAlignment="Left" 
                    VerticalAlignment="Bottom" 
                    CmdMiniMapMouseClick="{Binding CmdMiniMapMouseClick}"
                    LatLonNW="{Binding mapLatLonNW, Mode=TwoWay}"
                    LatLonSE="{Binding mapLatLonSE, Mode=TwoWay}"
                    ZoomLevel="{Binding miniMapZoomLevel}"
                    Center="{Binding Center, ElementName=MyXamlMainMap}"
                    />
            
                <Image Source="./Images/bing_logo.png"  Grid.Row="0" Grid.Column="2" VerticalAlignment="Bottom" HorizontalAlignment="Right" MaxHeight="20"  ></Image>



                <Button Grid.Row="0" Grid.Column="2" HorizontalAlignment="Left" VerticalAlignment="Top"    Height="20" Content="{Binding leftMenuCommandLabel}"     Command="{Binding CmdToggleShowLeftMenu}"></Button>
            <Button Grid.Row="0" Grid.Column="2"  HorizontalAlignment="Right" VerticalAlignment="Top"    Height="20" Content="{Binding rightMenuCommandLabel}"     Command="{Binding CmdToggleShowRightMenu}"></Button>

            <Grid x:Name="RightMenuGrid" Grid.Row="0" Grid.Column="4"     Visibility="{Binding isRightMenuVisible, Converter={StaticResource ConvertBoolToVisibility}}">
                <Grid.RowDefinitions>
                    <RowDefinition Height="*" />
                    <RowDefinition Height="2" />
                    <RowDefinition Height="*" />
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*"/>
                </Grid.ColumnDefinitions>

                <Grid x:Name="RegionLabelControl" Grid.Row="0">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="auto" />
                        <RowDefinition Height="*" />
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*" />
                    </Grid.ColumnDefinitions>

                    <StackPanel Orientation="Horizontal"  Grid.Row="0" Grid.Column="0"  Background="{StaticResource MainPageBackgroundBrush}" >
                        <dataInput:Label Content="Show Numbers:"    ToolTipService.ToolTip="Select a value below to show population numbers by Counties, VTDs, or Blocks"   ></dataInput:Label>
                        <CheckBox IsChecked="{Binding isRegionLabelOn, Mode=TwoWay}" />
                    </StackPanel>

                    <Grid Grid.Row="1" Background="{StaticResource MainPageBackgroundBrush}"  >
                        <Grid.RowDefinitions>
                            <RowDefinition Height="auto" />
                            <RowDefinition Height="auto" />
                            <RowDefinition Height="*" />
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*" />
                        </Grid.ColumnDefinitions>



                        <StackPanel Orientation="Horizontal"  Grid.Row="0" Grid.Column="0"  Background="{StaticResource MainPageBackgroundBrush}" >
                            <dataInput:Label Content="Dataset:"       ></dataInput:Label>
                                <dataInput:Label Content="{Binding criteriaDatasetName}"       ></dataInput:Label>
                        </StackPanel>

                        <!--<StackPanel Orientation="Horizontal"  Grid.Row="1" Grid.Column="0"  Background="{StaticResource MainPageBackgroundBrush}" >
                            <dataInput:Label Content="Data Item:"       ></dataInput:Label>
                            <dataInput:Label Content="{Binding RegionLabel.dataItemHeader}"       ></dataInput:Label>
                        </StackPanel>-->

                        <StackPanel Orientation="Horizontal"  Grid.Row="1" Grid.Column="0"  Background="{StaticResource MainPageBackgroundBrush}" >
                            <dataInput:Label Content="Choose Display and Format"       ></dataInput:Label>
                        </StackPanel>


                        <ListBox  Grid.Row="2" Grid.Column="0" ItemsSource="{Binding datasetCriteriaList}" Margin="0,0,0,0"   
	                                      Background="{StaticResource MainPageBackgroundBrush}" 
	                                      SelectedIndex="{Binding selectedDatasetCriteriaIndex, Mode=TwoWay}" 
	                                      ItemTemplate="{StaticResource DataTemplateMenuRegionLabels}"
	                                      >
                            <ListBox.ItemsPanel  >
                                <ItemsPanelTemplate>
                                    <StackPanel Orientation="Vertical" Background="{StaticResource MainPageBackgroundBrush}"></StackPanel>
                                </ItemsPanelTemplate>
                            </ListBox.ItemsPanel>
                        </ListBox>
                    </Grid>
                </Grid>

                <controls:GridSplitter x:Name="RightMenuGridlSplitter" Grid.Row="1" VerticalAlignment="Center" HorizontalAlignment="Stretch" Background="Blue" Height="4" ToolTipService.ToolTip="Drag to adjust Label/Shading size"></controls:GridSplitter>

                <Grid x:Name="RegionShadingControl" Grid.Row="2">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="auto" />
                        <RowDefinition Height="*" />
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*" />
                    </Grid.ColumnDefinitions>

                    <StackPanel Orientation="Horizontal"  Grid.Row="0" Grid.Column="0"  Background="{StaticResource MainPageBackgroundBrush}" >
                            <dataInput:Label Content="Show Concentration:"     ToolTipService.ToolTip="Select a value below to show population concentration by Counties, VTDs, or Blocks"    ></dataInput:Label>
                        <CheckBox IsChecked="{Binding showFill, Mode=TwoWay}" />
                    </StackPanel>

                    <Grid Grid.Row="1" Background="{StaticResource MainPageBackgroundBrush}" >
                        <Grid.RowDefinitions>
                            <RowDefinition Height="auto" />
                            <RowDefinition Height="auto" />
                            <RowDefinition Height="auto" />
                            <RowDefinition Height="auto" />
                            <RowDefinition Height="*" />
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*" />
                        </Grid.ColumnDefinitions>



                        <StackPanel Orientation="Horizontal"  Grid.Row="1" Grid.Column="0"  Background="{StaticResource MainPageBackgroundBrush}" >
                            <dataInput:Label Content="Dataset:"       ></dataInput:Label>
                                <dataInput:Label Content="{Binding criteriaDatasetName}"       ></dataInput:Label>
                        </StackPanel>

                        <!--<StackPanel Orientation="Horizontal"  Grid.Row="2" Grid.Column="0"  Background="{StaticResource MainPageBackgroundBrush}" >
                            <dataInput:Label Content="Data Item:"       ></dataInput:Label>
                            <dataInput:Label Content="{Binding RegionFill.dataItemHeader}"       ></dataInput:Label>
                        </StackPanel>-->

                        <StackPanel Orientation="Horizontal"  Grid.Row="2" Grid.Column="0"  Background="{StaticResource MainPageBackgroundBrush}" >
                            <dataInput:Label Content="Opacity:"       ></dataInput:Label>
                            <Slider Width="100" Minimum="0" Maximum="100" Value="{Binding opacity, Mode=TwoWay}"  />
                            <dataInput:Label Content="{Binding opacity}"       ></dataInput:Label>
                        </StackPanel>

                        <StackPanel Orientation="Horizontal"  Grid.Row="3" Grid.Column="0"  Background="{StaticResource MainPageBackgroundBrush}" >
                            <dataInput:Label Content="Shading:"  ></dataInput:Label>
                            <customUI:ColorScale   MinBackground="{Binding colorScaleMinBrush}"   MaxBackground="{Binding colorScaleMaxBrush}"  ColorScaleSectionList="{Binding colorScaleSectionList}"  ></customUI:ColorScale>
                        </StackPanel>

                        <!--<StackPanel Orientation="Horizontal"  Grid.Row="4" Grid.Column="0"  Background="{StaticResource MainPageBackgroundBrush}" >
                            <dataInput:Label Content="Display Criteria"       ></dataInput:Label>
                        </StackPanel>-->




                        <ListBox  x:Name="RegionFillListBox"  Grid.Row="4" Grid.Column="0"
                                ItemsSource="{Binding datasetCriteriaList}" Margin="0,0,0,0"   
                                ItemTemplate="{StaticResource DataTemplateRegionFillCriteria}"
                                Background="{StaticResource MainPageBackgroundBrush}" SelectedIndex="{Binding selectedDatasetCriteriaIndex, Mode=TwoWay}" 
                                VerticalAlignment="Stretch"
                                       >
                            <ListBox.ItemsPanel  >
                                <ItemsPanelTemplate>
                                    <StackPanel Orientation="Vertical" Background="{StaticResource MainPageBackgroundBrush}" ></StackPanel>
                                </ItemsPanelTemplate>
                            </ListBox.ItemsPanel>
                        </ListBox>

                    </Grid>
                </Grid>


            </Grid>


            <Border x:Name="DataGridBorder" Grid.Row="2" Grid.ColumnSpan="5"   BorderThickness="2" BorderBrush="Black"   
                    Background="{Binding serviceDAL.getDistrictDataSummaryRequestCount, Converter={StaticResource ConvertLoadingBrushFromInt}}"  
                     Visibility="{Binding districtPlan.districtCount, Converter={StaticResource ConvertVisibilityFromInt}}"
                      >
                <Grid x:Name="DataGridControlPanel" Grid.Row="1" Grid.Column="1" Background="Transparent" >
                    <Grid.RowDefinitions>
                        <RowDefinition Height="*" />
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="auto" />
                        <ColumnDefinition Width="*" />
                    </Grid.ColumnDefinitions>


                        <StackPanel Orientation="Vertical"  Grid.Column="0">
                            <dataInput:Label Content="{Binding criteriaDatasetName}"       ></dataInput:Label>

                            <Button Width="100" Height="20" Margin="5" Content="Save Data Grid" ToolTipService.ToolTip="Save DataGrid to Comma Separated Value (CSV) File"  Command="{Binding CmdFileSaveDataGrid}" ></Button>
                            <RadioButton GroupName="dataGridDisplayType" Content="District"  IsChecked="{Binding dataGridMode, Mode=TwoWay, Converter={StaticResource ConvertEnumToBool}, ConverterParameter=District}"  Margin="3"  />
                            <!--<RadioButton GroupName="dataGridDisplayType" Content="County"    IsChecked="{Binding viewModelBase.dataGridManager.dataGridMode, Mode=TwoWay, Converter={StaticResource ConvertEnumToBool}, ConverterParameter=County}"   Margin="5/>-->
                            <RadioButton GroupName="dataGridDisplayType" Content="Changed"   IsChecked="{Binding dataGridMode, Mode=TwoWay, Converter={StaticResource ConvertEnumToBool}, ConverterParameter=Changed}"   Margin="3"   />
                            <sdk:Label Content="Working"  HorizontalAlignment="Center"  Style="{StaticResource lblHeaderStyle}" />
                            <sdk:Label Content="Pop Dev"  HorizontalAlignment="Center"  Style="{StaticResource lblHeaderStyle}" />
                            <sdk:Label Content="{Binding workingPopulationDeviation }" ToolTipService.ToolTip="Total Population Deviation across all districts that have population" HorizontalAlignment="Center"  Style="{StaticResource lblDataStyle}"  />
                        </StackPanel>

                        <!-- NOTE: Creating columns and binding data is done Programmatically -->
                        <sdk:DataGrid x:Name="DataGridForDistrictSummaries" Grid.Column="1" 
                                  AutoGenerateColumns="False" 
                                  VerticalScrollBarVisibility="Visible"  
                                  HorizontalScrollBarVisibility="Visible" 
                                  HorizontalAlignment="Stretch" 
                                  VerticalAlignment="Stretch" 
                                  MinHeight="70"
                                  ItemsSource="{Binding dataGridView}"
                                  AlternatingRowBackground="LightBlue"
                            >
                    </sdk:DataGrid>
                    <!-- //Todo: Need to add a data template for the row data so we can highlight yellow the changed data -->
                </Grid>
            </Border>
            
            <controls:GridSplitter x:Name="MapLeftGridlSplitter" Grid.Row="0" Grid.Column="1"  VerticalAlignment="Stretch" HorizontalAlignment="Center" Background="Blue" ToolTipService.ToolTip="Drag to adjust left side menu size"></controls:GridSplitter>
            <controls:GridSplitter x:Name="MapRightGridlSplitter" Grid.Row="0" Grid.Column="3"  VerticalAlignment="Stretch" HorizontalAlignment="Center" Background="Blue" ToolTipService.ToolTip="Drag to adjust right side size"></controls:GridSplitter>
            <controls:GridSplitter x:Name="DataGridGridSplitter" Grid.Row="1" Grid.ColumnSpan="5" VerticalAlignment="Center" HorizontalAlignment="Stretch" Background="Blue" ToolTipService.ToolTip="Drag to adjust Map/DataGrid size"></controls:GridSplitter>
        </Grid>

        <StackPanel   Grid.Row="2"  Orientation="Horizontal" HorizontalAlignment="Left"   >

        </StackPanel>

        <!-- All popups will be added to this panel programatically -->
        <StackPanel x:Name="ChildwindowStackpanel"  Grid.Row="4" Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center" ></StackPanel>
        
    </Grid>
        <!--<Rectangle x:Name="WaitCursor" Fill="Transparent" Margin="0" Cursor="Wait"   Visibility="{Binding  districtBuildInProgress, Converter={StaticResource ConvertVisibilityFromBool}}" />-->
        
        
        <!-- Single Print -->
        <Grid  Grid.Row="0"  Visibility="{Binding isPDFViewVisible, Converter={StaticResource ConvertBoolToVisibility}}" Background="AntiqueWhite" >
            <Grid.RowDefinitions>
                <RowDefinition Height="auto" />
                <RowDefinition Height="*" />
            </Grid.RowDefinitions>
                <StackPanel Grid.Column="0" Orientation="Horizontal" Background="{Binding doc.PDFinsetLayerRetrieveCount, Converter={StaticResource ConvertLoadingBrushFromInt}}"   >
                    <sdk:Label Content="Retrieving Map Shape Layers : number remaining = "  HorizontalAlignment="Left"  Style="{StaticResource lblHeaderStyle}"   Visibility="{Binding doc.PDFinsetLayerRetrieveCount, Converter={StaticResource ConvertVisibilityFromInt}}" />
                    <sdk:Label Content="{Binding doc.PDFinsetLayerRetrieveCount}"       Visibility="{Binding doc.PDFinsetLayerRetrieveCount, Converter={StaticResource ConvertVisibilityFromInt}}"   ></sdk:Label>
                </StackPanel>
            <ListBox   Grid.Row="1" ItemsSource="{Binding PDFstatusList}" Margin="0,0,0,0"   
                                VerticalAlignment="Stretch"
                                HorizontalAlignment="Stretch"
                                Background="AntiqueWhite"
                                ScrollViewer.VerticalScrollBarVisibility="Visible">
            </ListBox>
        </Grid>
        
        <!-- Batch Print-->
        <Grid  Grid.Row="0"  Visibility="{Binding PDFBatchCount, Converter={StaticResource ConvertVisibilityFromInt}}" Background="AntiqueWhite" >
            <Grid.RowDefinitions>
                <RowDefinition Height="auto" />
                <RowDefinition Height="auto" />
                <RowDefinition Height="auto" />
                <RowDefinition Height="*" />
            </Grid.RowDefinitions>

            <StackPanel Grid.Row="1"  Orientation="Horizontal" >
                <sdk:Label Content="Generating PDF Maps : number remaining = "  HorizontalAlignment="Left"  Style="{StaticResource lblHeaderStyle}" />
                <sdk:Label Content="{Binding PDFBatchCount}"       ></sdk:Label>
            </StackPanel>

            <StackPanel Grid.Row="2"  Orientation="Horizontal" >
                <sdk:Label Content="Log: (Note, newest entries are at top) "  HorizontalAlignment="Left"  Style="{StaticResource lblHeaderStyle}" />
            </StackPanel>


            <ListBox   Grid.Row="3" ItemsSource="{Binding PDFstatusList}" Margin="0,0,0,0"   
                                VerticalAlignment="Stretch"
                                HorizontalAlignment="Stretch"
                                Background="AntiqueWhite"
                                ScrollViewer.VerticalScrollBarVisibility="Visible">
            </ListBox>

        </Grid>
    </Grid>
    
</UserControl>
